<template>
  <div class="todo-input">
    <input v-model="newTask" type="text" placeholder="请输入任务" @keyup.enter="addTask" />
   <button class="action-btn" @click="addTask">+</button>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'

const newTask = ref('')
const emit = defineEmits(['add'])
const addTask = () => {
  if (!newTask.value.trim()) return
  emit('add', newTask.value.trim())
  newTask.value = ''
}
</script>

<style scoped src="@/assets/TodoInput.css"></style>
